/*
 * st7789v.h
 *
 *  Created on: Aug 6, 2020
 *      Author: kychu
 */

#ifndef __ST7789V_H_
#define __ST7789V_H_

#include "driver/spi_master.h"
#include "lcd.h"

#ifdef __cplusplus
extern "C" {
#endif

/** @brief Initialize the LCD by putting some data in the graphics registers
 *
 * @param pin_conf Pointer to the struct with mandatory pins required for the LCD
 * @param spi_wr_dev Pointer to the SPI handler for sending the data
 * @return status
 */
esp_err_t lcd_init(lcd_conf_t* lcd_conf, spi_device_handle_t *spi_dev, lcd_dc_t *dc, int dma_chan);
esp_err_t lcd_cmd(spi_device_handle_t spi, uint16_t cmd, lcd_dc_t *dc);
esp_err_t lcd_data(spi_device_handle_t spi, const void *data, int len, lcd_dc_t *dc);
void lcd_window(spi_device_handle_t *spi, uint16_t xs, uint16_t xe, uint16_t ys, uint16_t ye, lcd_dc_t *dc);
void lcd_fast_fill(spi_device_handle_t *spi, uint16_t *data, uint16_t xs, uint16_t xe, uint16_t ys, uint16_t ye);
void lcd_fast_fill_finish(spi_device_handle_t *spi);
void lcd_disp_on(lcd_conf_t* lcd_conf);
void lcd_disp_off(lcd_conf_t* lcd_conf);
uint32_t lcd_get_id(void);

#ifdef __cplusplus
}
#endif

#endif /* __ST7789V_H_ */
